#pragma once
#include <esp_types.h>

#define RINGBUF_LENGTH 1024

typedef void (*RmtReceiveFunc_t)(int8_t* buf,size_t n,uint8_t axis);

typedef struct 
{
    int channel;
    int pin;
    RmtReceiveFunc_t recvcb;
    RingbufHandle_t ringbuf;
    uint8_t axis;
} encoder_rmt_t;

void encoder_rmt_init(rmt_channel_t channel,gpio_num_t pin,uint8_t clk_div,
                        uint8_t filter,uint16_t idle,RmtReceiveFunc_t recvfunc,uint8_t axis);